292 ◾ Bioinformatics
representative sequences are in a FASTA file and taxonomy in text file, we can import both
of them as follows:
qiime tools import \
--type ‘FeatureData[Sequence]’ \
--input-path gg_13_8_otus/rep_set/97_otus.fasta \
--output-path inputs/97_otus.qza
qiime tools import \
--type ‘FeatureData[Taxonomy]’ \
--input-format HeaderlessTSVTaxonomyFormat \
--input-path gg_13_8_otus/taxonomy/97_otu_taxonomy.txt \
--output-path inputs/ref-gg-97-taxonomy.qza
After importing the training datasets (sequences and taxonomy) into the “inputs” subdi-
rectory, we can then use the “fit-classifier-naive-bayes” method of the “feature-classifier”
plugin to train the naïve bayes classifier and to save it in the “classifiers” subdirectory that
we created earlier.
qiime feature-classifier fit-classifier-naive-bayes \
--i-reference-reads inputs/97_otus.qza \
--i-reference-taxonomy inputs/ref-gg-97-taxonomy.qza \
--o-classifier classifiers/nb-gg-97-classifier.qza
After fitting, you can use the classifier artifact “nb-gg-97-classifier.qza” with the “classify-
sklearn” method to assign taxa to our unclassified representative sequences.
qiime feature-classifier classify-sklearn \
--i-classifier classifiers/nb-gg-97-classifier.qza \
--i-reads dada2/rep-seqs_yoga_dada2.qza \
--o-classification dada2/nb2_tax_yoga_dada2.qza
In the above, we used both alignment-based classifiers (BLAST, VSEARCH) and machine
learning classifiers (pre-fitted and fitted) to assign taxa to the unclassified representative
sequences. The output of any of these classification steps is an artifact for the classified
sequences. Whatever classifier is used for taxonomy assignment, the following is applied
to view the taxonomy results. A visualization file can be created from the resulted artifact
using “q2-metadata” plugin with “tabulate” method as follows:
Visualizing the BLAST-based taxonomy assignment:
qiime metadata tabulate \
--m-input-file dada2/blast_tax_yoga_dada2.qza \
--o-visualization dada2/blast_tax_yoga_dada2.qzv
qiime tools view dada2/blast_tax_yoga_dada2.qzv
Visualizing the VSEARCH taxonomy assignment: